<template>
  <div>
    <el-container style="border: 1px solid #ccc">
      <el-container>
        <el-aside width="200px" style="background-color: #fff">
          <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
            background-color="#fff"
            text-color="#000"
            active-text-color="rgba(150,200,15)"
            :router="true"
          >
            <el-submenu index="1">
              <template slot="title"
                ><i class="el-icon-video-camera-solid"></i>功能点</template
              >
              <el-menu-item-group>
                <el-menu-item index="1-1" route="/filmview"
                  ><i class='el-icon-connection'></i> 级联选择</el-menu-item
                >
                <el-menu-item index="1-2" route="/filmviewOne"
                  ><i class="el-icon-s-operation"></i>描述列表
                  </el-menu-item
                >
                <el-menu-item index="1-3" route="/filmviewTwo"
                  ><i class="el-icon-more"></i> 步骤条</el-menu-item
                >
              </el-menu-item-group>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title"
                ><i class="el-icon-s-platform"></i>电视剧</template
              >
              <el-menu-item-group>
                <el-menu-item index="2-1" route="/filmviewThree"
                  ><i class="el-icon-time"></i> 流程</el-menu-item
                >
                <el-menu-item index="2-2" route="/filmviewFour"
                  ><i class="el-icon-circle-check"></i> 复选框模版</el-menu-item
                >
                <el-menu-item index="2-3" route="/filmviewFive"
                  >古装</el-menu-item
                >
              </el-menu-item-group>
            </el-submenu>
            <el-submenu index="3">
              <template slot="title"
                ><i class="el-icon-camera-solid"></i>动漫</template
              >
              <el-menu-item-group>
                <el-menu-item index="3-1" route="/filmviewSix"
                  >内地</el-menu-item
                >
                <el-menu-item index="3-2" route="/filmviewSeven"
                  >日本</el-menu-item
                >
                <el-menu-item index="3-3" route="/filmviewEight"
                  >地图实例</el-menu-item
                >
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-container>
          <!-- 面包屑 -->
          <el-breadcrumb
            separator-class="el-icon-arrow-right"
            style="padding-top: 10px; height: 30px"
          >
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item v-if="this.$route.path !== '/'">{{
              breadcrumbName(this.$route.path)
            }}</el-breadcrumb-item>
          </el-breadcrumb>
          <el-main>
            <!-- 路由出口，渲染与当前菜单项关联的组件 -->
            <router-view></router-view>
          </el-main>
          <el-footer style="height: 20px; color: #ccc"></el-footer>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>  
  <script>
export default {
  name: "HomeView",
  data() {
    const item = {
      date: "2016-05-02",
      name: "王小虎",
      address: "上海市普陀区金沙江路 1518 弄",
    };
    return {
      tableData: Array(20).fill(item),
      activeMenu: "/", // 当前激活的菜单项
      routePaths: {
        "/": "首页",
        "/filmview": "级联选择",
        "/filmviewOne": "描述列表",
        "/filmviewTwo": "步骤条",
        "/filmviewThree": "流程",
        "/filmviewFour": "复选框模版",
        "/filmviewFive": "古装",
        "/filmviewSix": "内地",
        "/filmviewSeven": "日本",
        "/filmviewEight": "地图实例",
      },
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      // console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      // console.log(key, keyPath);
    },

    // 面包屑
    breadcrumbName(route) {
      // console.log("route=" + route);
      // console.log(this.routePaths[route], "this.routePaths[route]");
      return this.routePaths[route] || "未知";
    },
  },
  watch: {
    $route(to, from) {
      this.activeMenu = to.path;
    },
  },
};
</script>



  <style scoped>
.el-aside {
  color: #48b7d1;
}
.el-main {
  background: #FFE;
  /* height: calc(100vh - 100px); */
  height: 93vh;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}
.item {
  margin-top: 0px;
  margin-right: 40px;
}
</style>